package org.example.aop.jdkproxy;

import lombok.Data;

import java.lang.reflect.Proxy;

@Data
public class HouseProxy {

    public IHouse getHouseProxy(IHouse house) {
        return (IHouse) Proxy.newProxyInstance(house.getClass().getClassLoader(), house.getClass().getInterfaces(), (proxy, method, args) -> {
            System.out.println("i'm sale proxy");
            return method.invoke(house, args);
        });
    }

}
